// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './styles/main.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { createPinia } from 'pinia'
import http from '@/axios'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import * as Cesium from 'cesium';
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzZGUwMjRlNS1mMjI4LTQyODktYTU5Ny0wODkzMjU4MTE0ZDkiLCJpZCI6MzUyNTk5LCJpYXQiOjE3NjEwNDAyMTF9.exwOrK7brruQhGm2OquPTxcbtM81ybIXbOIBYV_3Pus';
// 全局配置axios
console.log('API基础URL:', import.meta.env.VITE_API_BASE_URL)

// 开发环境日志配置
if (import.meta.env.MODE === 'development') {
    console.log('[DEV] 开发模式，Mock服务已禁用')
}

const app = createApp(App)
const pinia = createPinia()



app.use(router)
app.use(ElementPlus)
app.use(pinia)

// 全局属性配置
app.config.globalProperties.$http = http

app.mount('#app')

// 开发环境全局变量
if (import.meta.env.MODE === 'development') {
    window.__APP__ = app
    window.__PINIA__ = pinia
    window.__ROUTER__ = router
}

// 全局注册ElementPlus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}